<?php /* Smarty version 2.6.27, created on 2019-11-07 19:00:17
         compiled from channel/edit.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 't', 'channel/edit.tpl', 4, false),)), $this); ?>
<form method="post" id="form" action="admin.php?ctrl=channel&act=submit&type=add">
    <table class="itable itable-color">
        <tr>
            <th><?php echo ((is_array($_tmp='标识')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
            <td><input type="text" required value="<?php echo $this->_tpl_vars['channel']['flag']; ?>
" name="flag" <?php if ($this->_tpl_vars['channel']['flag']): ?>readonly<?php endif; ?>/>
            </td>
        </tr>

        <tr>
          <th width="160px;"><?php echo ((is_array($_tmp='名称')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
          <td>
          <input type="text" required value="<?php echo $this->_tpl_vars['channel']['name']; ?>
" name="name"/>
          </td>
        </tr>

        <tr>
          <td></td>
          <td><input type="submit" class="gbutton"  value="<?php echo ((is_array($_tmp='提交')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
" /></td>
        </tr>
      </table>
 </form>
<br/><br/>

<table  class="itable itable-color">
    <tr>
        <td>渠道ID</td>
        <td>渠道标识</td>
        <td>渠道名称</td>
        <td>创角时间</td>
        <td>操作</td>
    </tr>
    <?php $_from = $this->_tpl_vars['channel']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
    <tr>
        <td><?php echo $this->_tpl_vars['item']['id']; ?>
</td>
        <td><?php echo $this->_tpl_vars['item']['flag']; ?>
</td>
        <td><?php echo $this->_tpl_vars['item']['name']; ?>
</td>
        <td><?php echo $this->_tpl_vars['item']['created_time']; ?>
</td>
        <td>
            <a style="text-decoration: underline; cursor: pointer; color: #ff0000;" onclick="del(<?php echo $this->_tpl_vars['item']['id']; ?>
)" ">删除</a>
        </td>
    </tr>
    <?php endforeach; endif; unset($_from); ?>
</table>


<script type="text/javascript">
    $('#form').ajaxForm({
        complete: function(xhr) {
            var msg = xhr.responseText;//JSON.parse();
            if (msg)
                $.dialog.alert(msg)
            else
                $tabs.tabs( "load" , 0 )
        }
    });
    function del(id){
        $.post('admin.php?ctrl=channel&act=submit',{id:id,type:'del'}, function(msg){
            if (msg)
                $.dialog.alert(msg)
            else
                $tabs.tabs( "load" , 0 )
        })
    }

</script>